{include file="../../../application/admin/view/public/head" /}
<style>
    table {
        table-layout: fixed;
    }


    td {
        overflow: hidden;
        white-space: nowrap;
        text-overflow: ellipsis;
    }
    .layui-field-box .layui-btn{
        margin: 3px 5px;
    }
</style>
<div class="page-container p10">

    <div class="my-toolbar-box">

        <div class="left mb10">
            <fieldset class="layui-elem-field">
                <legend>推荐 - 栏目管理</legend>
                <div class="layui-field-box">
                   app首页推荐页面栏目管理
                </div>
            </fieldset>
        </div>

        <div class="layui-btn-group">
            <a class="layui-btn layui-btn-primary j-iframe"  data-href="{:url('info')}" href="javascript:;" title="添加栏目"><i class="layui-icon">&#xe654;</i>添加栏目</a>
            <a data-href="{:url('deleterecommend')}" class="layui-btn layui-btn-primary j-page-btns confirm"><i class="layui-icon">&#xe640;</i>删除栏目</a>

        </div>

    </div>


    <form class="layui-form " method="post" id="pageListForm">
        <table class="layui-table" lay-size="sm">
            <thead>
            <tr>
                <th width="25"><input type="checkbox" lay-skin="primary" lay-filter="allChoose"></th>
                <th width="40">编号</th>
                <th >名称</th>
                <th width="50">排序</th>
                <th width="80">内容</th>
                <th width="140">更新时间</th>
                <th width="200">操作</th>
            </tr>
            </thead>

            {volist name="list" id="vo"}
            <tr>
                <td><input type="checkbox" name="ids[]" value="{$vo.id}" class="layui-checkbox checkbox-ids" lay-skin="primary"></td>
                <td>{$vo.id}</td>
                <td>
                     <a class="layui-badge-rim j-iframe" data-full="1" data-href="{:url('vodindex',['xilie_id'=>$vo.id])}" href="javascript:void(1)" title="查看数据列表">{$vo.name|htmlspecialchars}</a>
                    {if condition="$vo.is_show eq 0"}
                    <span class="layui-badge" onclick="changeShow('{$vo.id}','is_show',1)" >隐藏</span>
                    {/if}
                </td>
                <td><a data-href="{:url('index/select')}?tab=recommend&col=sort&tpl=select_sort&val={$vo.sort}&url=recommend/field&ids={$vo.id}" data-width="270" data-height="100" class=" j-select"><span class="layui-badge layui-bg-orange">{$vo.sort}</span></a></td>
                <td>{$vo.content}</td>
                <td>{$vo.time_added|mac_day=color}</td>
                <td>
                    <a class="layui-badge-rim j-iframe" data-full="1" data-href="{:url('info?xilie_id='.$vo['id'])}" href="javascript:;" title="编辑">编辑</a>
                    <a class="layui-badge-rim j-tr-del" data-href="{:url('deleterecommend?ids='.$vo['id'])}" href="javascript:;" title="删除">删除</a>
<!--                    <a class="layui-badge-rim" target="_blank" href="/v2.php?type=tuijian&xilie_id={$vo['id']}"  title="删除">处理m3u8</a>-->
                </td>
            </tr>
            {/volist}
            </tbody>
        </table>
        <div id="pages" class="center"></div>
    </form>
</div>




{include file="../../../application/admin/view/public/foot" /}

<script type="text/javascript">
    var curUrl="{:url('recommend/index',$param)}";
    layui.use(['laypage', 'layer','form'], function() {
        var laypage = layui.laypage
                , layer = layui.layer,
                form = layui.form;

        laypage.render({
            elem: 'pages'
            ,count: {$total}
            ,limit: {$limit}
            ,curr: {$page}
            ,layout: ['count', 'prev', 'page', 'next', 'limit', 'skip']
            ,jump: function(obj,first){
                console.log(obj);
                if(!first){
                    location.href = curUrl.replace('%7Bpage%7D',obj.curr).replace('%7Blimit%7D',obj.limit);
                }
            }
        });

    });
    function changeShow(id,field,val){
        $.ajax({
            type:'post',
            dataType:'json',
            url:'{:url("recommend/field")}',
            data:{
                ids:id,
                col:field,
                tab:'recommend',
                val:val
            }
        }).done(function (ret){
            console.log(ret);
            // location.reload();
            if(ret.code==1){
                location.reload();
            }else{
                alert(ret.msg);
            }
        })
    }

</script>
</body>
</html>